﻿//
(function() {

// insert your plugin name here
// eg : var mypluginname = 'image';

var mypluginname = 'image';

$(window).data('gui').plugins[mypluginname] =
{

	makeHTML : function(param)
	{
		/*
		options['titlebar-fixe'];
		*/

		var obj = document.createElement("img"); // don't erase
		var url = param.xml.getAttribute('data-url');
		obj.setAttribute('data-effect','image');
		//$(obj).css('backgroundImage', 'url('+url + ')');
		obj.src = url;
		param.parent.appendChild(obj);
	
		guiTareNameSpace.executeChildrensPlugin(param.xml,obj);
		return obj; // don't erase
		// return null if error
	},

	makeXML : function(xml)
	{
		var element = xml.ownerDocument.createElement(mypluginname); // don't erase
		element.setAttribute('data-url',this.get(0).style.backgroundImage);
		return element; // don't erase
		// return null if error
	},

	loadImage : function(url)
	{
		if (url.trim()) {
			//this[0].style.backgroundImage  = "url("+ url + ")";
			this[0].setAttribute('data-url',url);
			//this.jquery.css('backgroundImage', 'url('+url + ')');
			this[0].src = url;
		
		}
		return this;
	},
	
  enable : function(flag)
  {
	if (flag !== undefined && flag !== null)
	{
		if (flag == true || flag == false) this[0].disabled = !flag;
		return this;
	} else {
		return (this[0].disabled == false);
	}
  }
 }
})();